<?php
if ( empty($paramsArr['tid']) )
{
	header("Location: index.php");
	die();
}

$sql = "select * from topic where tid=" . $paramsArr['tid'];
$rs_t = $link->execute($sql);
$tname = $rs_t->fields('tname_' . $_SESSION['cur_lang']);
$strFilter = '';

$dt = (!get_magic_quotes_gpc()) ? addslashes(@$_POST['dtDate']) : @$_POST['dtDate'];

if ( !empty($dt) )
	$sql = "SELECT * FROM article WHERE datepost='" . toMYSQLDate($dt) . "' AND tid=" . $paramsArr['tid'];
else
	$sql = "SELECT * FROM article WHERE tid=" . $paramsArr['tid'];

$rs = $link->execute($sql);

$mcontent = '';

$template->set_filenames(array(
'filter_article'=>'filter_article.tpl'
));

$template->assign_vars(array(
'T_NEWS_VIEWBYDATE' => $lang['l_news_viewbydate'],
'T_NEWS_TOPPAGE' => $lang['l_news_toppage'],
'T_NEWS_FILTERACTION' => setURLParams('act=dyn&mod=News&f=filterarticle&tid='.$paramsArr['tid']),
'T_NEWS_TOPICNAME' => $tname
));
if ( !$rs->EOF )
{
	$auto = 0;
	while ( !$rs->EOF )
	{
		$strFilter = '';
		if ( $auto++ % 2 == 0 )	$clr = "#F0F0F0";
		else $clr = "transparent";
		
		if ( $rs->fields('picture') == 0 )
			$strFilter .= $rs->fields('short_content_' . $_SESSION['cur_lang']);
		else
		{
			$strFilter .= '<img src="images.php?imgid=' . $rs->fields('picture') . '" border="0" align="absmiddle" style="position: fixed; float: left" vspace="10" hspace="10">';
			$strFilter .= $rs->fields('short_content_' . $_SESSION['cur_lang']);
		}

		$template->assign_block_vars('filter_content',array(
			'T_NEWS_ROWCOLOR' => $clr,
			'T_NEWS_VIEWLINK' => setURLParams('act=dyn&mod=News&f=viewarticle&aid=' . $rs->fields('autoid')),
			'T_NEWS_NEWSTITLE' => $rs->fields('title_' . $_SESSION['cur_lang']),
			'T_NEWS_DATE' => ToVNDate($rs->fields('datepost')),
			'T_NEWS_CONTENT' => $strFilter,
			'T_NEWS_VIEWFULL' => setURLParams('act=dyn&mod=News&f=viewarticle&aid=' . $rs->fields('autoid'))
		));
	
		$rs->MoveNext();
	}//end whiel rs_a
}
else
{
	$template->assign_block_vars('filter_contentnotmatch',array(
		'T_NEWS_FILTERNOTMATCH' => $lang['l_news_filternotmacth']
	));
}

$template->pparse('filter_article');
?>